<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="common/include :: header('客户列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                <ul>
                    <li>
                        关键字：<input type="text" name="name"/>
                        出生日期:<input type="text" class="time-input" name="DateBirth"/>
                        -<input type="text" class="time-input" name="DateToBirth"/>
                    </li>
                    <li>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否vip：</label>
                            <div class="col-sm-8">
                                <select name="vip" class="form-control m-b">
                                    <option value="">所有</option>
                                    <option value="true">是</option>
                                    <option value="false">否</option>
                                </select>
                            </div>
                        </div>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                    </li>
                </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:post:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-warning" id="payBtn" >
                <i class="fa fa-paypal"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
        <th:block th:include="common/include :: footer" />
        <script th:inline="javascript">

            var prefix = ctx + "/business/busCustomer";
            $(function () {
                // 表格的属性
                var options = {
                    url: prefix + "/query",   //查询数据的请求
                    createUrl: prefix + "/addPage",  //点击新增跳转的地址
                    updateUrl: prefix + "/editPage?id={id}", //点击编辑跳转的地址
                    removeUrl: prefix + "/remove", //点击删除跳转的地址
                 //   exportUrl: prefix + "/export", // 数据导出请求的地址
                 //   sortName: "age",   //后台根据什么字段进行排序
                    modalName: "养修服务项", //模态框名称
                    columns: [{
                        checkbox:true
                    },
                        {
                            field: 'name',
                            title: '客户姓名',
                        },
                        {
                            field: 'phone',
                            title: '联系方式',
                        },

                        {
                            field: 'birthday',
                            title: '生日',
                        },
                        {
                            field: 'vip',
                            title: '是否套餐',
                            formatter: function(value, row, index) {
                                return value?'是':'否'
                            }
                        },
                        {
                            field: 'remark',
                            title: '备注信息',
                            formatter: function(value, row, index) {
                                return $.table.tooltip(value,5);
                            }
                        },
                        {
                            title: '操作',
                            align: 'center',
                            formatter: function(value, row, index) {
                                var actions = [];

                                actions.push('<a class="btn btn-success btn-xs '+'" href="javascript:void(0)" ' +
                                    'onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                                    actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)"' +
                                        ' onclick="$.operate.remove('+row.id+')"><i class="fa fa-remove"></i>删除</a>');

                                return actions.join('');
                            }
                        }]
                };
                $.table.init(options);
            })
            $('#payBtn').click(function () {
                window.open("/business/busCustomer/export")
            })
        </script>

<script>
</script>
</body>
</html>